Private Declare Function GdipLoadImageFromFile Lib "gdiplus.dll" (ByVal FileName As Long, GpImage As Long) As Long
Private Declare Function GdiplusStartup Lib "gdiplus.dll" (token As Long, gdipInput As GdiplusStartupInput, GdiplusStartupOutput As Long) As Long
Private Declare Function GdipCreateFromHDC Lib "gdiplus.dll" (ByVal hdc As Long, GpGraphics As Long) As Long
Private Declare Function GdipSetInterpolationMode Lib "gdiplus.dll" (ByVal Graphics As Long, ByVal InterMode As Long) As Long
Private Declare Function GdipDeleteGraphics Lib "gdiplus.dll" (ByVal Graphics As Long) As Long
Private Declare Function GdipDisposeImage Lib "gdiplus.dll" (ByVal Image As Long) As Long
Private Declare Function GdipGetImageWidth Lib "gdiplus.dll" (ByVal Image As Long, Width As Long) As Long
Private Declare Function GdipGetImageHeight Lib "gdiplus.dll" (ByVal Image As Long, Height As Long) As Long
Private Declare Function GdipDrawImageRectRectI Lib "gdiplus.dll" (ByVal Graphics As Long, ByVal GpImage As Long, ByVal dstx As Long, ByVal dsty As Long, ByVal dstwidth As Long, ByVal dstheight As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal SrcWidth As Long, ByVal SrcHeight As Long, ByVal srcUnit As Long, ByVal imageAttributes As Long, ByVal callback As Long, ByVal callbackData As Long) As Long
Private Declare Sub GdiplusShutdown Lib "gdiplus.dll" (ByVal token As Long)
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function lStrlenW Lib "kernel32" (ByVal lpString As Long) As Long
Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal codepage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Any, ByVal cchWideChar As Long, ByVal lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
Private Declare Function GdipSaveImageToFile Lib "gdiplus" (ByVal Image As Long, ByVal FileName As Long, ByRef clsidEncoder As GUID, ByRef encoderParams As Any) As Long
Private Declare Function GdipGetImageEncodersSize Lib "gdiplus" (ByRef numEncoders As Long, ByRef Size As Long) As Long
Private Declare Function GdipGetImageEncoders Lib "gdiplus" (ByVal numEncoders As Long, ByVal Size As Long, ByRef Encoders As Any) As Long
Private Declare Function GdipSetSmoothingMode Lib "gdiplus" (ByVal Graphics As Long, ByVal SmoothingMode As SmoothingMode) As GpStatus
Private Declare Function GdipSaveGraphics Lib "gdiplus" (ByVal Graphics As Long, ByVal State As Long) As GpStatus
' Initialises GDI Plus
Private Function InitGDIPlus(ByVal token As Long) As Long
Dim gdipInit As GdiplusStartupInput
gdipInit.GdiplusVersion = 1
GdiplusStartup token, gdipInit, ByVal 0&
InitGDIPlus = token
End Function
' Frees GDI Plus
Private Sub FreeGDIPlus(token As Long)
GdiplusShutdown token
End Sub
Public Sub GetImageSize(ByVal PicFile As String, ByVal ImgWidth As Long, ByVal ImageHeight As Long)
Dim Img As Long, ImgW As Long, ImgH As Long
GdipLoadImageFromFile StrPtr(PicFile), Img
GdipGetImageWidth Img, ImgW
GdipGetImageHeight Img, ImgH
ImgWidth = ImgW
ImageHeight = ImgH
GdipDisposeImage Img
End Sub
'Private Function GetImageSize(ByVal ImageFile As String) As SizeL
' Dim token As Long
' Dim Img As Long
' Dim gps As GdiplusStartupInput
' gps.GdiplusVersion = 1
'
' GdiplusStartup token, gps
'
' GdipLoadImageFromFile StrPtr(ImageFile), Img
' GdipGetImageWidth Img, GetImageSize.cx
' GdipGetImageHeight Img, GetImageSize.cy
' GdipDisposeImage Img
'
' GdiplusShutdown token
'End Function
' Resize the picture using GDI plus
Public Function LoadPictureToHDC(strFile As String, hdc As Long, ByVal DestX As Long, ByVal DestY As Long, ByVal DestWidth As Long, ByVal DestHeight As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal SrcWidth As Long, ByVal SrcHeight As Long) As Long
yAsle(tokeutd, ImgyVaeex-C entI anE ee)wnkyAs Long
* tcatokebanE ee)wnkyAs tptee)kyAPO.ics As LongL
yAsle(tokeutd, Imgy,(rFilOr,a(spo(strFisle(tocyYNotIntI acp ee)eutuaWstWidth /, ImgH Vaeex-C entI anamee)krVxrAny,TkSum ConsAs I and As 0geeutuaWstW * t1ks I andw Gp Suestowa" I andwrGp Suestowa" I anE ee)wnkyAs tptee)kyAPO.ics As LoAs anE eetpteeanE ees AmFm